package com.zyy.composite;

/**
 * @Description: 菜单选项 继承菜单组件
 * @Author: zyy
 * @Date: 2023/07/31 22:30
 */
public class MenuItem extends MenuComponent {

    public MenuItem(String name, int level) {
        this.name = name;
        this.level = level;
    }

    @Override
    public void print() {
        for (int i = 0; i < this.level; i++) {
            System.out.print("--");
        }
        System.out.println(this.level + this.name);

    }
}
